package com.ada.id3;

import com.mpatric.mp3agic.*;

import java.io.IOException;

public class App {

    public static void main(String[] args) throws InvalidDataException, UnsupportedTagException, IOException, NotSupportedException {
        Mp3File file=new Mp3File("E:\\野子.mp3");
        ID3v2 id3v2 = file.getId3v2Tag();
        ID3v1 id3v1 = file.getId3v1Tag();

        if (id3v2 != null) {

            System.out.println("id3v2");

            System.out.println(id3v2.getTitle());//专辑名
            id3v2.setTitle("野子");
            id3v2.setArtist("贾跃亭");
            file.setId3v2Tag(id3v2);
            file.save("E:\\野子1.mp3");
        } else {
            System.out.println("id3v1");
            System.out.println(id3v1.getTitle());
            System.out.println(id3v1.getAlbum());

        }

    }
}
